// 引入拖拽插件
import React, { useEffect, useState } from 'react';
import './component/style.scss';
import { Box } from './component/Box';
import { FormContent } from './component/FormContent';
import { DialogProps } from './component/types';
import { userEvents } from '..';
import { CmdDisEn, EventNum } from '../types/event';

// 拖拽容器
export const CmdDialogForm = (props: DialogProps) => {
  const [disabled, setDisabled] = useState<boolean>(false);
  useEffect(() => {
    userEvents.on(EventNum.PICK_SELECT_UNSELECTED, (value) => {
      setDisabled(value === CmdDisEn.DISABLE); // 根据 ToolBarEvents.DIS_EN_ABLE 事件的值设置禁用状态
    });
  }, []);
  return (
    <Box {...props}>
      <FormContent
        {...props}
        disabled={disabled} // 将 disabled 传递给 CmdDialogForm
      />
    </Box>
  );
};
